package Test2;

public class Cat {
	private String name;
	private int health;
	private String sex;
	private int lazy;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getHealth() {
		return health;
	}
	public void setHealth(int health) {
		if(health<1 || health>100) {
			System.out.println("健康值非法，恢复默认值！");
			health=60;
		}
		this.health = health;
	}
	public String getSex() {
		return sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	public int getLazy() {
		return lazy;
	}
	public void setLazy(int lazy) {
		if(lazy<1 || lazy >10) {
			System.out.println("慵懒度非法，恢复默认值！");
			lazy=5;
		}
		this.lazy = lazy;
	}
	//两个类里均有宠物自白的方法show，展示宠物的信息，包括昵称，性别，健康值，与主人的亲密度或懒度。
	public void show() {
		System.out.println("宠物自白："+"\n我叫"+name+",性别是"+sex+",健康值是"+health+"，慵懒度是"+lazy);

	}
	
	
}
